﻿using mds.Common;

using mds.Queue.Generic;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Serialization;

namespace demotest
{
    class Program
    {
        static void Main(string[] args)
        {
            QueueProcessor<string> operateQueue = new QueueProcessor<string>(
          "SuccessionIDPQueue",
          10,
          TaskExecutionQueuePolicy.ConstrainQueueDepthThrottleExecution,
          Priority.Highest,
          10000, 0);

            operateQueue.ProcessQueue = OperateAdapter;
            operateQueue.CompletedQueue = CompletedQueue;
            operateQueue.Enqueue("测试1\n");
            Console.Write("同步输出\n");
            Console.ReadKey();
        }

        private static void OperateAdapter(QueueProcessor<string> referenceQueue, string item)
        {
            Console.Write("异步输出{0}\n",item);
        }

        private static void CompletedQueue()
        {
            Console.Write("异步完成输出\n");
        }
    }
}
